#! /bin/bash

set -e

tar -zxvf /opt/software/jdk-8u212-linux-x64.tar.gz -C /opt/module

tee -a /etc/profile.d/set_env.sh <<-'EOF'
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_212
export PATH=$PATH:$JAVA_HOME/bin

EOF

source /etc/profile

java -version


echo -e '#JAVA_HOME\nexport JAVA_HOME=/opt/module/jdk1.8.0_212\nexport PATH=$PATH:$JAVA_HOME/bin'